home *** CD-ROM | disk | FTP | other *** search
/ E.M.Computergraphic Phase 4 / Phase 4 - Desktop Video Dreams (E. M. Computergraphic)(1996).iso / utilities / imagestudio / rexx / regionrecall.isrx < prev    next >
Text File  |  1996-01-17  |  3KB  |  113 lines

  1. /* ImageStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. /* Make sure there is an image */
  15.  
  16. IMAGEINFO_GET STEM imageinfoinfo.
  17.  
  18. if imageinfoinfo.width == -1 then do
  19.     REQUEST_MESSAGE TEXT '"No image."'
  20.     exit
  21.     end
  22.  
  23. /* Warn if a region already exists */
  24.  
  25. REGION_GET STEM regioninfo.
  26.  
  27. if regioninfo.minx ~= -1 then
  28.     REQUEST_MESSAGE TEXT '"Loose currently selected region?"',
  29.         BUTTONTEXT '"OK|Cancel"'
  30.  
  31. /* Did user press 'Cancel' ? */
  32.  
  33. if result == 0 then
  34.     exit
  35.  
  36. /* Get the clip info */
  37.  
  38. clipargs = getclip('regioninfo')
  39.  
  40. if clipargs == '' then do
  41.     REQUEST_MESSAGE TEXT '"Cannot get recall region info."'
  42.     exit
  43.     end
  44.  
  45. /* Set the values */
  46.  
  47. interpret clipargs
  48.  
  49. /* Set the region */
  50.  
  51. REGION_SET region_minx region_miny region_width region_height
  52.  
  53. /* END PROGRAM ***************************************************/
  54.  
  55. exit
  56.  
  57. /* On ERROR */
  58.  
  59. ERROR:
  60.  
  61. /* If we get here, either an error occurred with the command's */
  62. /* execution or there was an error with the command itself. */
  63. /* In the former case, rc2 contains the error message and in */
  64. /* the latter, rc2 contains an error number. SIGL contains */
  65. /* the line number of the command which caused the jump */
  66. /* to ERROR: */
  67.  
  68. if datatype(rc2,'NUMERIC') == 1 then do
  69.     /* See if we can describe the error with a string */
  70.  
  71.     select
  72.         when rc2 == 103 then
  73.             err_string = "ERROR 103, "||,
  74.                 "out of memory at line "||SIGL
  75.         when rc2 == 114 then
  76.             err_string = "ERROR 114, "||,
  77.                 "bad command template at line "||SIGL
  78.         when rc2 == 115 then
  79.             err_string = "ERROR 115, "||,
  80.                 "bad number for /N argument at line "||SIGL
  81.         when rc2 == 116 then
  82.             err_string = "ERROR 116, "||,
  83.                 "required argument missing at line "||SIGL
  84.         when rc2 == 117 then
  85.             err_string = "ERROR 117, "||,
  86.                 "value after keywork missing at line "||SIGL
  87.         when rc2 == 118 then
  88.             err_string = "ERROR 118, "||,
  89.                 "wrong number of arguments at line "||SIGL
  90.         when rc2 == 119 then
  91.             err_string = "ERROR 119, "||,
  92.                 "unmatched quotes at line "||SIGL
  93.         when rc2 == 120 then
  94.             err_string = "ERROR 120, "||,
  95.                 "line too long at line "||SIGL
  96.         when rc2 == 236 then
  97.             err_string = "ERROR 236, "||,
  98.                 "unknown command at line "||SIGL
  99.         otherwise
  100.             err_string = "ERROR "||rc2||", at line "||SIGL
  101.         end
  102.         end
  103. else if rc2 == 'RC2' then do
  104.     err_string = "ERROR in command at line "||SIGL
  105.     end
  106. else do
  107.         err_string = rc2||", line "||SIGL
  108.         end
  109.  
  110. request_message TEXT '"'err_string'"'
  111.  
  112. exit
  113.